package com.zlq.cn.admin.controller;


import com.zlq.cn.admin.domain.SysConfig;
import com.zlq.cn.admin.service.SysConfigService;
import com.zlq.cn.api.SignApiResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 系统配置表 前端控制器
 * </p>
 *
 * @author zhoucl
 * @since 2022-12-21
 */
@RestController
@RequestMapping("/api/admin/config")
public class SysConfigController {

    @Resource
    private SysConfigService sysConfigService;

    @ApiOperation("获取配置")
    @GetMapping("/get")
    public SignApiResult<SysConfig> get(String unKey) {
        return SignApiResult.resultSuccess(sysConfigService.getById(unKey));
    }

    @ApiOperation("修改配置")
    @PostMapping("/edit")
    public SignApiResult<Boolean> edit(@Valid @RequestBody SysConfig sysConfig) {
        return SignApiResult.resultSuccess(sysConfigService.edit(sysConfig));
    }
}

